home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 95 / pascal / make_dat.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-01-15  |  1.0 KB  |  45 lines

  1.      PROGRAM make_data;
  2.  
  3.      { Create a data file of RECORDs }
  4.  
  5.        CONST
  6.          {$I gemconst.pas}
  7.  
  8.        TYPE
  9.          {$I gemtype.pas}
  10.  
  11.          rating = ( chief, cook, bottle_washer );
  12.  
  13.          info = record
  14.                   name : string [30];
  15.                   rank : rating;
  16.                 end; {info definition}
  17.  
  18.        VAR
  19.          myfile : file of INFO;
  20.          myrec  : info;
  21.          iloop  : integer;
  22.  
  23.      {$I gemsubs.pas}
  24.  
  25.      BEGIN
  26.        IF Init_Gem >= 0 THEN
  27.          BEGIN
  28.            Rewrite( myfile, 'A:\INFO.DAT' );
  29.            FOR iloop := 1 to 3 DO
  30.              BEGIN
  31.                Write( 'Name: ');
  32.                Readln( myrec.name );
  33.                CASE iloop OF
  34.                  1 : myrec.rank := chief;
  35.                  2 : myrec.rank := cook;
  36.                  3 : myrec.rank := bottle_washer;
  37.                END; {case}
  38.                myfile^ := myrec;
  39.                Put( myfile );
  40.              END;
  41.            Close( myfile );
  42.          END;
  43.        Exit_Gem;
  44.      END.
  45.